import { request } from "@/utils/request";

import { PermisstionResponseData } from "./type";

enum API{
     //获取全部职位
    ALLPERMISSION_URL = '/admin/acl/permission',
    //新增菜单
    ADDPERMISSION_URL = '/admin/acl/permission/save',
    //更新一个菜单
    UPDATAPERMISSION_URL = '/admin/acl/permission/update',
    //删除菜单
    DELETEPERMISSION_URL = '/admin/acl/permission/remove/'
}
//角色权限-获取全部职位
export const reqAllPermission = ()=>request.get<any,PermisstionResponseData>(API.ALLPERMISSION_URL)
//添加角色
export const reqAddPermission = (data:any)=>{
    if(data.id){
        return request.put<any,any>(API.UPDATAPERMISSION_URL)
    }else{
        return request.post<any,any>(API.ADDPERMISSION_URL)
    }
}
//删除菜单
export const reqDeletePermission = (id:number)=>request.delete<any,any>(API.DELETEPERMISSION_URL+id)